import request from '#/utils/requestAbort.js';

// 使用新服务的交易单元，黑龙江、陕西
export const useNewService = ['PDBLJ', 'PXBSX'];

export function getDictionaryStatus() {
  return request('/reanalyze/forecastDataAdjustReanalyze/dictionaryStatus', {
    method: 'GET',
  });
}

// 查询可选日期
export function getOptionalDate(data: any) {
  const { marketId } = data;
  const url = `${
    useNewService.includes(marketId) ? '/private-business' : '/clearing-settlement'
  }/settlementManage/date`;
  return request(url, {
    method: 'POST',
    data,
  });
}

// 查询
export function settlementDatas(data: any) {
  const { marketId } = data;
  const url = `${
    useNewService.includes(marketId) ? '/private-business' : '/clearing-settlement'
  }/settlementManage/settlementDatas`;
  return request(url, {
    method: 'post',
    data,
  });
}

export function exportExcel(data: any) {
  const { marketId } = data;
  const url = `${
    useNewService.includes(marketId) ? '/private-business' : '/clearing-settlement'
  }/longTermDecomposition/exportExcel`;
  return request(url, {
    method: 'post',
    data,
    responseType: 'blob',
    getResponse: true,
  });
}

// 导出文件接口-用于预览pdf的时候调用
export function downLoadFile(fileId: string) {
  return request(`/annex/annex/downLoadFile/${fileId}`, {
    method: 'GET',
    responseType: 'blob',
  });
}
